﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SWDataDB.Models;
using SWDataDB.DAL;

namespace SWDataDB.BLL
{
    // 
    public class QDInfoEntry
    {
        public QDInfoEntry() { }


        #region ===录入各个区调信息，形参为对象===
        /// <summary>
        /// 调用存储过程 ，更新或插入
        /// </summary>
        /// <param name="zltbl"></param>
        /// <returns></returns>
        public int ZLInfoUpdateOrInsert(ZL_TBL zltbl)
        {
            ZLInfo info = new ZLInfo();

            return info.UpdateOrInsertZLInfo(zltbl);
        }
        /// <summary>
        ///  录入ZL_INFO
        /// </summary>
        /// <returns></returns>
        public int ZLInfoAppend(ZL_TBL zltbl)
        {
            ZLInfo info = new ZLInfo();

            return info.AddZLInfo(zltbl);
        }

        public int PMInfoAppend(PM_TBL pm)
        {
            PMInfo info = new PMInfo();

            return info.AddPMInfo(pm);
        }

        public int UTILInfoAppend(UTIL_TBL util)
        {
            UTILInfo info = new UTILInfo();

            return info.AppendUTILInfo(util);
        }

        public int XGDataAppend(XGDATA_TBL xg)
        {
            XGInfo info = new XGInfo();

            return info.AddXGInfo(xg);
        }

        public int BBInfoAppend(BB_INFO_TBL bb)
        {
            BBInfo info = new BBInfo();

            return info.AddbbInfo(bb);
        }

        public int BPInfoAppend(BP_INFO_TBL bp)
        {
            BPInfo info = new BPInfo();

            return info.AddbpInfo(bp);
        }

        public int GPInfoAppend(GP_INFO_TBL gp)
        {
            GPInfo info = new GPInfo();

            return info.AddGPInfo(gp);
        }

        public int YPInfoAppend(YP_INFO_TBL yp)
        {
            YPInfo info = new YPInfo();

            return info.AddYPInfo(yp);
        }
    
        #endregion

        #region ===录入区调信息，形参为各个字段===

        /// <summary>
        ///  录入ZL_INFO
        /// </summary>
        /// <returns></returns>
        public int ZLInfoAppend(string i_GC_DEPART,
        string i_FILE_ID,             //档    号
        string i_TITLE,               //题    名
        string i_UNIT,                //形成单位
        string i_HX_PEOPLE,           //汇交人
        string i_PEOJ_NAME,           //项目名称
        string i_PEOJ_CODE,           //项目编码 
        string i_DATA_CLASS,          //资料类别
        string i_CLASS_CODE,          //资料类别代码
        string i_ADMIN_REGION,        //行政区
        string i_ADMINREG_CODE,       //行政区代码
        string i_MINE_NAME,           //矿区名称
        string i_SHEET_NAME,          //图幅名称
        string i_SHEET_ID,            //图幅号
        string i_WORK_LEVEL,          //工作程度
        string i_WORKLEVEL_ID,        //工作程度代码
        string i_START_DATE,        //起始时间
        string i_END_DATE,          //终止时间
        int i_START_LONGITUDE,        //起始经度
        int i_START_LATITUDE,        //起始纬度
        int i_END_LONGITUDE,           //终止经度
        int i_END_LATITUDE,           //终止纬度
        string i_MAJOR_MINE,          //主要矿种
        string i_MINE_CODE,           //矿产代码
        string i_PUTIN_DATE,        //入库时间
        string i_TRANSF_CODE,         //移交清单编号
        int i_YXIN_NUM_ZL,              //实物数量_岩心_个钻孔
        int i_YXIN_NUM_X,              //实物数量_岩心_箱
        int i_YXIN_NUM_M,             //实物数量_岩心_米
        int i_YXIE_NUM_ZL,             //实物数量_岩屑_个钻孔
        int i_YXIE_NUM_X,             //实物数量_岩屑_箱
        int i_YXIE_NUM_D,              //实物数量_岩屑_袋
        int i_BB_NUM_X,              //实物数量_岩屑_箱
        int i_BB_NUM_K,              //实物数量_岩屑_块
        int i_GP_NUM_H,              //实物数量_光片_盒
        int i_GP_NUM_J,             //实物数量_光片_件
        int i_YP_NUM_X,              //实物数量_岩屑_箱
        int i_YP_NUM_D,              //实物数量_岩屑_袋
        int i_BP_NUM_H,             //实物数量_薄片_盒
        int i_BP_NUM_J,              //实物数量_薄片_件
        int i_QTSW_NUM_X,             //实物数量_其它实物_箱
        int i_QTSW_NUM_J,             //实物数量_其它实物_件
        int i_XGZL_NUM_W,              //实物数量_相关资料_文
        int i_XGZL_NUM_T,             //实物数量_相关资料_图
        int i_XGZL_NUM_J,              //实物数量_相关资料_件
        string i_SECU_LEVEL,          //密级      
        string i_SECU_ID,            //密级代码
        string i_SECU_ITEMS,          //涉密事项
        string i_PROTECT_DATE,     //保护期
        string i_DEAD_LINE,           //保管期限
        string i_CG_UNIT,             //成果资料保存单位
        string i_CG_CODE,             //成果资料档号
        string i_YS_UNIT,             //原始资料保存单位
        string i_YS_CODE,             //原始资料档号
        string i_KEY_WORDS,           //关键词
        string i_ABSTRACT,              //内容提要
        string i_REMARK)              //备注)
        {
            ZL_TBL zltbl = new ZL_TBL();
            ZLInfo info = new ZLInfo();

            zltbl.O_GC_DEPART = i_GC_DEPART;
            zltbl.O_FILE_ID = i_FILE_ID;             //档    号
            zltbl.O_TITLE = i_TITLE;               //题    名
            zltbl.O_UNIT = i_UNIT;                //形成单位
            zltbl.O_HX_PEOPLE = i_HX_PEOPLE;           //汇交人
            zltbl.O_PEOJ_NAME = i_PEOJ_NAME;           //项目名称
            zltbl.O_PEOJ_CODE = i_PEOJ_CODE;           //项目编码 
            zltbl.O_DATA_CLASS = i_DATA_CLASS;          //资料类别
            zltbl.O_CLASS_CODE = i_CLASS_CODE;          //资料类别代码
            zltbl.O_ADMIN_REGION = i_ADMIN_REGION;        //行政区
            zltbl.O_ADMINREG_CODE = i_ADMINREG_CODE;       //行政区代码
            zltbl.O_MINE_NAME = i_MINE_NAME;           //矿区名称
            zltbl.O_SHEET_NAME = i_SHEET_NAME;          //图幅名称
            zltbl.O_SHEET_ID = i_SHEET_ID;            //图幅号
            zltbl.O_WORK_LEVEL = i_WORK_LEVEL;          //工作程度
            zltbl.O_WORKLEVEL_ID = i_WORKLEVEL_ID;        //工作程度代码
            zltbl.O_START_DATE = i_START_DATE;        //起始时间
            zltbl.O_END_DATE = i_END_DATE;          //终止时间
            zltbl.O_START_LONGITUDE = i_START_LONGITUDE;        //起始经度
            zltbl.O_START_LATITUDE = i_START_LATITUDE;        //起始纬度
            zltbl.O_END_LONGITUDE = i_END_LONGITUDE;           //终止经度
            zltbl.O_END_LATITUDE = i_END_LATITUDE;           //终止纬度
            zltbl.O_MAJOR_MINE = i_MAJOR_MINE;          //主要矿种
            zltbl.O_MINE_CODE = i_MINE_CODE;           //矿产代码
            zltbl.O_PUTIN_DATE = i_PUTIN_DATE;        //入库时间
            zltbl.O_TRANSF_CODE = i_TRANSF_CODE;         //移交清单编号
            zltbl.O_YXIN_NUM_ZL = i_YXIN_NUM_ZL;              //实物数量_岩心_个钻孔
            zltbl.O_YXIN_NUM_X = i_YXIN_NUM_X;              //实物数量_岩心_箱
            zltbl.O_YXIN_NUM_M = i_YXIN_NUM_M;             //实物数量_岩心_米
            zltbl.O_YXIE_NUM_ZL = i_YXIE_NUM_ZL;             //实物数量_岩屑_个钻孔
            zltbl.O_YXIE_NUM_X = i_YXIE_NUM_X;             //实物数量_岩屑_箱
            zltbl.O_YXIE_NUM_D = i_YXIE_NUM_D;              //实物数量_岩屑_袋
            zltbl.O_BB_NUM_X = i_BB_NUM_X;              //实物数量_岩屑_箱
            zltbl.O_BB_NUM_X = i_BB_NUM_K;              //实物数量_岩屑_块
            zltbl.O_GP_NUM_H = i_GP_NUM_H;              //实物数量_光片_盒
            zltbl.O_GP_NUM_J = i_GP_NUM_J;             //实物数量_光片_件
            zltbl.O_YP_NUM_X = i_YP_NUM_X;              //实物数量_岩屑_箱
            zltbl.O_YP_NUM_D = i_YP_NUM_D;              //实物数量_岩屑_袋
            zltbl.O_BP_NUM_H = i_BP_NUM_H;            //实物数量_薄片_盒
            zltbl.O_BP_NUM_J = i_BP_NUM_J;              //实物数量_薄片_件
            zltbl.O_QTSW_NUM_X = i_QTSW_NUM_X;             //实物数量_其它实物_箱
            zltbl.O_QTSW_NUM_J = i_QTSW_NUM_J;             //实物数量_其它实物_件
            zltbl.O_XGZL_NUM_W = i_XGZL_NUM_W;              //实物数量_相关资料_文
            zltbl.O_XGZL_NUM_T = i_XGZL_NUM_T;          //实物数量_相关资料_图
            zltbl.O_XGZL_NUM_J = i_XGZL_NUM_J;              //实物数量_相关资料_件
            zltbl.O_SECU_LEVEL = i_SECU_LEVEL;         //密级      
            zltbl.O_SECU_ID = i_SECU_ID;            //密级代码
            zltbl.O_SECU_ITEMS = i_SECU_ITEMS;          //涉密事项
            zltbl.O_PROTECT_DATE = i_PROTECT_DATE;    //保护期
            zltbl.O_DEAD_LINE = i_DEAD_LINE;          //保管期限
            zltbl.O_CG_UNIT = i_CG_UNIT;            //成果资料保存单位
            zltbl.O_CG_CODE = i_CG_CODE;             //成果资料档号
            zltbl.O_YS_UNIT = i_YS_UNIT;             //原始资料保存单位
            zltbl.O_YS_CODE = i_YS_CODE;             //原始资料档号
            zltbl.O_KEY_WORDS = i_KEY_WORDS;          //关键词
            zltbl.O_ABSTRACT = i_ABSTRACT;             //内容提要
            zltbl.O_REMARK = i_REMARK;            //备注)

            return info.AddZLInfo(zltbl);
        }

        public int PMInfoAppend(string code
           ,string pm_name
           ,string pm_code
           ,int bb_num
           ,int yp_num
           ,int gp_num
           ,int bop_num
           ,string pm_quality
           ,String scale
           ,int pm_slon
           ,int pm_slat
           ,string pm_summary
           ,string pm_ldes
           //,pm_image
           ,string key_words
           ,string test_people
           ,string pm_date
           , string zl_id)
        {
            PM_TBL pm = new PM_TBL();
            PMInfo info = new PMInfo();

            pm.O_PM_CODE = code;
            pm.O_PM_NAME = pm_name;
            pm.O_PM_CODE = pm_code;
            pm.O_BB_NUM = bb_num;
            pm.O_YP_NUM = yp_num;
            pm.O_GP_NUM = gp_num;
            pm.O_BOP_NUM = bop_num;
            pm.O_PM_QUALITY = pm_quality;
            pm.O_SCALE = scale;
            pm.O_PM_SLON = pm_slon;
            pm.O_PM_SLAT = pm_slat;
            pm.O_PM_SUMMARY = pm_summary;
            pm.O_PM_LDES = pm_ldes;
            pm.O_KEY_WORDS = key_words;
            pm.O_TEST_PEOPLE = test_people;
            pm.O_PM_DATE = pm_date;
            pm.O_ZL_FILE_ID = zl_id;

            return info.AddPMInfo(pm);
        }

        /// <summary>
        /// 实体信息录入
        /// </summary>
        /// <param name="code">外键</param>
        /// <param name="sw_type"></param>
        /// <param name="swNum"></param>
        /// <param name="col_name"></param>
        /// <param name="colDat"></param>
        /// <returns></returns>

        public int UTILInfoAppend(string code, string sw_type, int swNum,
            string col_name, string colDat)
        {
            UTIL_TBL util = new UTIL_TBL();
            UTILInfo info = new UTILInfo();


            util.O_ZL_FILE_ID = code;
            util.O_SW_TYPE = sw_type;
            util.O_SW_NUM = swNum;
            util.O_COL_NAME = col_name;
            util.O_COL_DATE = colDat;
            // 
            //             return info.AppendUTILInfo(util);
            return 1;
        }

        public int XGDataAppend(string code, string style, string name, string scale, int num, string zl_id)
        {
            XGDATA_TBL xg = new XGDATA_TBL();
            XGInfo info = new XGInfo();

            xg.O_XG_CODE = code;
            xg.O_DATA_STYLE = style;
            xg.O_DATA_NAME = name;
            xg.O_SCALE = scale;
            xg.O_NUM = num;
            xg.O_ZL_FILE_ID = zl_id;

            return info.AddXGInfo(xg);
        }

        public int BBInfoAppend(string code, string bb_name, string path_name, string path_num, string att_num,
            string cy_pos, string method, string cy_level, string cj_people, string cj_date, int lat, int lon,
                string style, string bp_id, string out_name, string innar_name, string remark, string zl_id)
        {
            BB_INFO_TBL xg = new BB_INFO_TBL();
            BBInfo info = new BBInfo();

            xg.O_BB_CODE = code;
            xg.O_BB_NAME = bb_name;
            xg.O_PM_PATH_NAME = path_name;
            xg.O_PM_PATH_NUM = path_num;
            xg.O_GEO_ATT_NUM = att_num;
            xg.O_CY_POS = cy_pos;
            xg.O_QY_METHOD = method;
            xg.O_CY_LEVEL = cy_level;
            xg.O_CJ_PEOPLE = cj_people;
            xg.O_CJ_DATE = cj_date;
            xg.O_BB_LAT = lat;
            xg.O_BB_LON = lon;
            xg.O_BB_STYLE = style;
            xg.O_BP_ID = bp_id;
            xg.O_OUT_NAME = out_name;
            xg.O_INNAR_NAME = innar_name;
            xg.O_REMARK = remark;

            xg.O_ZL_FILE_ID = zl_id;

            return info.AddbbInfo(xg);
        }

        public int BPInfoAppend(string code
           , string bp_name
           , string pm_path_name
           , string pm_path_num
           , string feature
           , string describ
           , string jd_name
           , string jggz
           , string jd_people
           , string jd_date
           , string lr_people
           , string lr_date
           , string zl_id)
        {
            BP_INFO_TBL bp = new BP_INFO_TBL();
            BPInfo info = new BPInfo();

            bp.O_BP_CODE = code;
            bp.O_BP_NAME = bp_name;
            bp.O_PM_PATH_NAME = pm_path_name;
            bp.O_PM_PATH_NUM = pm_path_num;
            bp.O_FEATURE = feature;
            bp.O_DESCRIB = describ;
            bp.O_JD_NAME = jd_name;
            bp.O_JD_DATE = jd_date;
            bp.O_LR_PEOPLE = lr_people;
            bp.O_LR_DATE = lr_date;
            bp.O_ZL_FILE_ID = zl_id;

            return info.AddbpInfo(bp);
        }

        public int GPInfoAppend(string code
           , string gp_name
           , string pm_path_name
           , string pm_path_num
           , string feature
           , string describ
           , string jd_name
           , string jggz
           , string jd_people
           , string jd_date
           , string lr_people
           , string lr_date
           , string zl_id)
        {
            GP_INFO_TBL gp = new GP_INFO_TBL();
            GPInfo info = new GPInfo();

            gp.O_GP_CODE = code;
            gp.O_GP_NAME = gp_name;
            gp.O_PM_PATH_NAME = pm_path_name;
            gp.O_PM_PATH_NUM = pm_path_num;
            gp.O_FEATURE = feature;
            gp.O_DESCRIB = describ;
            gp.O_JD_NAME = jd_name;
            gp.O_JGGZ = jggz;
            gp.O_JD_PEOPLE = jd_people;
            gp.O_JD_DATE = jd_date;
            gp.O_LR_PEOPLE = lr_people;
            gp.O_LR_DATE = lr_date;
            gp.O_ZL_FILE_ID = zl_id;

            return info.AddGPInfo(gp);
        }

        public int YPInfoAppend(string code
           , string yp_name
           , string pm_path_name
           , string pm_path_num
           , string geo_att_num
           , int yp_lat
           , int yp_lon
           , string yp_style
           , string style_code
           , string bp_id
           , string out_name
           , string innar_name
           , string remark
           , string cy_pos
           , string cy_level
           , string cj_people
           , string cj_date
           , string zl_id)
        {
            YP_INFO_TBL yp = new YP_INFO_TBL();
            YPInfo info = new YPInfo();

            yp.O_YP_CODE = code;
            yp.O_YP_NAME = yp_name;
            yp.O_PM_PATH_NAME = pm_path_name;
            yp.O_PM_PATH_NUM = pm_path_num;
            yp.O_GEO_ATT_NUM = geo_att_num;
            yp.O_YP_LAT = yp_lat;
            yp.O_YP_LON = yp_lon;
            yp.O_YP_STYLE = yp_style;
            yp.O_STYLE_CODE = style_code;
            yp.O_BP_ID = bp_id;
            yp.O_OUT_NAME = out_name;
            yp.O_INNAR_NAME = innar_name;
            yp.O_REMARK = remark;
            yp.O_CY_POS = cy_pos;
            yp.O_CY_LEVEL = cy_level;
            yp.O_CJ_PEOPLE = cj_people;
            yp.O_CJ_DATE = cj_date;
            yp.O_ZL_FILE_ID = zl_id;

            return info.AddYPInfo(yp);
        }
        #endregion
    }
}
